package com.le.tester.onjava8.l1_11;

import java.util.Random;

/**
 * createTime：2022/10/28 14:04
 * description：多路分发
 */
public class RoShamBo1 {
    static final int size = 20;

    private static Random random = new Random(47);

    public static Item newItem() {
        switch (random.nextInt(3)) {
            default:
            case 0:
                return new Scissors();
            case 1:
                return new Paper();
            case 2:
                return new Rock();
        }
    }

    public static void match(Item a, Item b) {
        System.out.println(a + "vs." + b + ": " + a.compete(b));
    }

    public static void main(String[] args) {
        for (int i = 0; i < size; i++) {
            match(newItem(), newItem());
        }
    }
}
